package me.xue.communityhealth.repo;

import me.xue.communityhealth.model.DrugPlace;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
@Mapper
public interface DrugPlaceRepository {

    @Insert("INSERT INTO `drug_place`(name,detail) VALUES(#{name},#{detail})")
    int save(DrugPlace drugPlace);

    @Update("UPDATE `drug_place` SET name=#{name},detail=#{detail} WHERE id=#{id}")
    int update(DrugPlace drugPlace);

    @Delete("DELETE FROM `drug_place` WHERE id=#{id}")
    int delete(Integer id);

    @Select("SELECT * FROM `drug_place` WHERE id=#{id}")
    DrugPlace findOne(Integer id);

    @Select("SELECT * FROM `drug_place`")
    List<DrugPlace> findAll();

}
